package com.qiangqiang.task.server.controller;

import com.qiangqiang.task.server.entity.Comments;
import com.qiangqiang.task.server.entity.Follow;
import com.qiangqiang.task.server.service.FollowService;
import com.qiangqiang.task.server.util.ResultVOUtil;
import com.qiangqiang.task.server.vo.ResultVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: task
 * @description:
 * @author: Sky.lin
 * @create: 2018-12-31 14:37
 **/
@RestController
@RequestMapping(value = "/follow")
public class FollowController {

    @Autowired
    FollowService followService;

    @PostMapping("/addFollowRecord")
    public ResultVO addFollowRecord(Follow follow) {
        return ResultVOUtil.success(followService.addFollowRecord(follow));
    }

    @GetMapping("/isFollowed")
    public ResultVO isFollowed(@Param("userId") long userId, @Param("followerId") long followerId){
        return ResultVOUtil.success(followService.isFollowed(userId,followerId));
    }


    @GetMapping("/findAllFollow")
    public ResultVO findAllFollow(@Param("userId") long userId){
        return ResultVOUtil.success(followService.findAllFollow(userId));
    }
    @GetMapping("/findAllFans")
    public ResultVO findAllFans(@Param("followId") long followId){
        return ResultVOUtil.success(followService.findAllFans(followId));
    }
}
